public class service { 

    public service(ApexPages.StandardController controller) {
    
    }
   public Service_Request__c sr {get; set;}
             
   //To store the picklist value which we have selected on VF page.
    public String Service { get; set; }    
   
    //To display list of picklist values on VF page
    public List<selectOption> getPicklistvalues() {
        List<selectOption> options = new List<selectOption>();       
        options.add(new selectOption('Type1','Type1'));
        options.add(new selectOption('Type2','Type2'));
        options.add(new selectOption('Type3','Type3'));
        options.add(new selectOption('Type4','Type4'));
        return options;
    }   

   //To make four pageblocksections invisible by default
    public Boolean Type1tf = false;
    public Boolean Type2tf = false;
    public Boolean Type3tf = false;
    public Boolean Type4tf = false;   
    
    //To dynamically pass Boolean values to rendered attribute on pageblocksection
    public void setStype1(Boolean b) {
        this.Type1tf = b;
    }
    public Boolean getStype1() {
        return this.Type1tf;
    }    
    
    
    public void setStype2(Boolean b) {
        this.Type2tf = b;
    }
    public Boolean getStype2() {
        return this.Type2tf;
    }
    
    public void setStype3(Boolean b) {
        this.Type3tf = b;
    }
    public Boolean getStype3() {
        return this.Type3tf;
    }    
    public void setStype4(Boolean b) {
        this.Type4tf = b;
    }
    public Boolean getStype4() {
        return this.Type4tf;
    } 
 
   //Through actionfunction or actionsupport this method will be called to VF page
    public PageReference selectcountry() {
        if(Service == 'Type2') {
        setStype2(True);
        setStype1(False);
        setStype3(False);
        setStype4(False);
        }
        else if(Service == 'Type3') {
        setStype3(True);
        setStype2(False);
        setStype1(False);
        setStype4(False);

        }
        else if(Service == 'Type4'){
        setStype4(True);
        setStype2(False);
        setStype1(False);
        setStype3(False);
            }
       else{
        setStype1(True);
        setStype2(False);
        setStype3(False);
        setStype4(False);
            }
        return null;
      }
    }